import request from "@/utils/request";

// 获取角色列表数据
export const getRoleList = (params) => {
  return request({
    url: '/sys/role',
    params
  })
}

// 添加角色
export const addRole = (data) => {
  return request({
    url: '/sys/role',
    method: 'post',
    data
  })
}

// 编辑角色
export const editRole = (data) => {
  return request({
    url: `/sys/role/${data.id}`,
    method: "put",
    data
  })
}

// 删除角色
export const delRole = (id) => {
  return request({
    url: `/sys/role/${id}`,
    method: 'delete'
  })
}

// 获取角色详情数据
export const getRoleDetail = (id) => {
  return request({
    url: `/sys/role/${id}`
  })
}

// 给角色分配权限
export const assignPermission = (data) => {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}